package cn.kgc.tangcco.service.impl;

import cn.kgc.tangcco.model.ResponseText;
import cn.kgc.tangcco.model.ResultCode;
import cn.kgc.tangcco.pojo.Clazz;
import cn.kgc.tangcco.service.ClazzService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

/**
 * @author 李昊哲
 * @Description
 * @create 2020/12/26 15:32
 */
@Service
public class ClazzServiceImpl implements ClazzService {
    @Resource
    private Clazz clazz;

    @Override
    public ResponseText<List<Clazz>> queryClazzes(Clazz clazz) {
        List<Clazz> clazzes = clazz.selectList(new QueryWrapper<>());
        if (clazzes != null && clazzes.size() > 0) {
            return new ResponseText(ResultCode.SUCCESS.getCode(), ResultCode.SUCCESS.getMsg(), clazzes);
        }
        return new ResponseText(ResultCode.DATA_EMPTY.getDesc(), ResultCode.DATA_EMPTY.getMsg(), new ArrayList<Clazz>());
    }
}
